home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Shareware
/
IDimager Personal 4.2.0.3
/
setup_IDimager_Personal_V4.exe
/
{app}
/
web
/
modules
/
resulttable.inc
< prev
next >
Wrap
Text File
|
2008-06-21
|
9KB
|
210 lines
%include publicfunctions.inc %/include
function AddPageNumber (APage, i: Integer; ADataSetID: String; AItems: TCatalogItems): WideString;
begin
result := toWideString('');
result := result + '<div id="pageNo">';
if i = APage then
result := result + '<span class="activepage"> '
else
result := result + ' <a href="javascript:getHTML(''%var:PageOffset/./modules/resulttable.psc'', ''' + AjaxContainer + ''', ''ds=' + ADataSetID + '&GUID=' + AItems.GUID + '&Page=' + IntToStr(i) + ''')">';
result := result + IntToStr(i);
if i = APage then
result := result + ' </span>'
else
result := result + '</a> ';
result := result + '</div>';
end;
function IncludeResultTable (AItems: TCatalogItems; ADataSetID: String; APage: Integer; ACount: Integer; AThumbSize: Integer): WideString;
const
cSquare = 1; // set to 0 or 1 (= false or true); default = 0
cQuality = 1; // set to 0 or 1 (= false or true); default = 0
cThumbSize = 160; // set to a positive value to get a predefined size; default = 0
var
i: Integer;
AItem: TCatalogItem;
ALink: String;
AStartIndex: Integer;
APages: Integer;
begin
result := toWideString('');
if ACount <= 0 then
ACount := ThumbCount;
if AThumbSize <= 0 then
AThumbSize := cThumbSize;
APages := (AItems.Count div ACount) + 1;
if AItems.Count mod ACount = 0 then
Dec (APages);
AStartIndex := (APage - 1) * ACount;
result := result + '<table class="thumbsTable" cellspacing="0" cellpadding="0">';
if (AItems.Name <> '') or ((AItems.Name ='') and (APages > 1)) then
begin
result := result + ' <tr>';
result := result + ' <td height="30" valign="center">';
result := result + '<table class="thumbsTableHeader" width="100%" height="100%" cellspacing="0" cellpadding="0">';
result := result + ' <tr>';
result := result + ' <td>';
result := result + '<div id="headerLeft">' + AItems.Name + '</div>';
result := result + '<div id="headerNav" class="navimage">';
if APage < APages then
begin
ALink := 'javascript:getHTML(''%var:PageOffset/./modules/resulttable.psc'', ''' + AjaxContainer + ''', ''ds=' + ADataSetID + '&GUID=' + AItems.GUID + '&Page=' + IntToStr(APage + 1) + ''')';
result := result + '<a href="' + ALink + '">' +
'<img src="%var:PageOffset/images/trans-next.png" alt="next page..." title="next page...">' +
'</a>';
end
else
result := result + '<img src="%var:PageOffset/images/trans-blank.png">';
result := result + '</div>';
ALink := IntToStr(APage);
result := result + '<div id="pageNr">';
if APages > 1 then
begin
for i := 1 to Length(ALink) do
result := result + '<img src="%var:PageOffset/images/num' + MidStr(ALink, i, 1) + '.png">';
end;
result := result + '</div>';
result := result + '<div id="headerNav" class="navimage">';
if APage > 1 then
begin
ALink := 'javascript:getHTML(''%var:PageOffset/./modules/resulttable.psc'', ''' + AjaxContainer + ''', ''ds=' + ADataSetID + '&GUID=' + AItems.GUID + '&Page=' + IntToStr(APage - 1) + ''')';
result := result + '<a href="' + ALink + '">' +
'<img src="%var:PageOffset/images/trans-prev.png" alt="previous page..." title="previous page...">' +
'</a>';
end
else
result := result + '<img src="%var:PageOffset/images/trans-blank.png">';
result := result + '</div>';
result := result + ' </td>';
result := result + ' </tr>';
result := result + '</table>';
result := result + ' </td>';
result := result + ' </tr>';
end;
result := result + ' <tr>';
result := result + ' <td>';
result := result + '<div id="fullImage">';
i := AStartIndex;
while i <= AItems.Count - 1 do
begin
AItem := AItems.Items[i];
ALink := 'javascript:getHTMLChain(' +
'[' +
' [''%var:PageOffset/./modules/showimage.psc'', ''fullImage'', ''ds=' + ADataSetID + '&GUID=' + AItems.GUID + '&Page=' + IntToStr(i + 1) + '&count=' + IntToStr(ACount) + '&thumbsize=' + IntToStr(AThumbSize) + '''], ' +
' [''%var:PageOffset/./modules/showimagedetails.psc'', ''editDetails'', ''ds=' + ADataSetID + '&GUID=' + AItems.GUID + '&Page=' + IntToStr(i + 1) + '&count=' + IntToStr(ACount) + '&thumbsize=' + IntToStr(AThumbSize) + '''], ' +
' [''%var:PageOffset/./modules/imagecomments.psc'', ''comments'', ''ds=' + ADataSetID + '&GUID=' + AItems.GUID + '&Page=' + IntToStr(i + 1) + '''] ' +
']' +
')';
{
ALink := 'javascript:getHTMLWithSuccess(' +
'''%var:PageOffset/./modules/showimage.psc'', ' +
'''%var:PageOffset/./modules/showimagedetails.psc'', ' +
'''fullImage'', ' +
'''editDetails'', ' +
'''ds=' + ADataSetID + '&GUID=' + AItems.GUID + '&Page=' + IntToStr(i + 1) + '&count=' + IntToStr(ACount) + '&thumbsize=' + IntToStr(AThumbSize) + ''' ' +
')';
}
//result := result + '<div class="thumbnail" id="' + AItem.GUID + '" style="width: ' + IntToStr(iif(AThumbSize = 0, Options.Thumbsize, AThumbSize)) + 'px; height: ' + IntToStr(iif(AThumbSize = 0, Options.Thumbsize, AThumbSize)) + 'px;">';
result := result + '<div class="thumbnail" id="' + AItem.GUID + '">';
result := result + {IntToStr(i + 1) + '<br/>' +}
'<center><a href="' + ALink + '">' +
'<img class="thumbnailimage" src="%var:PageOffset/loadimage.psc?image=' +
AItem.GUID +
'&thumb=1' +
iif(AThumbSize > 0, '&size=' + IntToStr(AThumbSize), '') +
iif(cSquare = 1, '&square=1', '') +
iif(cQuality = 1, '&quality=1', '') +
'" ' +
'alt="' + FormatForHTMLEditing(AItem.ImageName) + '" ' +
'title="' + FormatForHTMLEditing(AItem.ImageName) + '" ' +
iif((AThumbSize > 0) and (cSquare = 1), 'width="' + IntToStr(AThumbSize) + '" ', '') +
iif((AThumbSize > 0) and (cSquare = 1), 'height="' + IntToStr(AThumbSize) + '" ', '') +
'>' +
'</a></center>' +
'';
result := result + '</div>';
Inc(i);
if i >= AStartIndex + ACount then
break;
end;
result := result + '</div>';
result := result + ' </td>';
result := result + ' </tr>';
result := result + ' <tr>';
result := result + ' <td height="20" valign="center">';
if APages > 1 then
begin
result := result + '<div id="pageNo">' + IntToStr(AItems.Count) + ' images</div>';
result := result + ' ';
for i := 1 to 3 do
begin
if (i < 1) or (i > APages) then
Continue;
result := result + AddPageNumber (APage, i, ADataSetID, AItems);
end;
if APage > 7 then
result := result + '<div id="pageNo">...</div>';
for i := APage - 3 to APage + 3 do
begin
if (i < 4) or (i > APages) then
Continue;
result := result + AddPageNumber (APage, i, ADataSetID, AItems);
end;
if APage + 3 < APages - 3 then
result := result + '<div id="pageNo">...</div>';
for i := APages - 2 to APages do
begin
if (i <= APage + 3) then
Continue;
result := result + AddPageNumber (APage, i, ADataSetID, AItems);
end;
end;
result := result + ' </td>';
result := result + ' </tr>';
result := result + '</table>';
end;